#region Librerias

using System;
using ESF.SFT.FileUploader.SharedResources;
using ESF.GTK;
using ESF.GTK.Elements;
using Gtk;
using ESF.SFT.FileUploader.Presenter.General;

#endregion


namespace ESF.SFT.FileUploaderGTK
{
	public partial class InternetConnectionOptions
		: BaseGTKDialog<InternetConnectionOptionsPresenter, IInternetConnectionOptionsViewer>, IInternetConnectionOptionsViewer
	{
		#region Constructor

		public InternetConnectionOptions (Window pParent) 
			: base (pParent)
		{
			_Presenter = new InternetConnectionOptionsPresenter(this); 
			
			Build();

			imgIcon.Pixbuf = GTKConverter.ImageToPixbuf(SharedImages.NetworkConnections_64x64);

			txtProxyUserLogin.HasFocus = true;


			_Presenter.Load ();
		}

		#endregion


		#region Button Events

		private void btnDefineProxySettings_Click(object sender, EventArgs args)
		{
			if (_Presenter.TryConnect())
			{
				Hide();
			}
		}

		#endregion


		#region Window Events

		protected void OnDeleteEvent(object sender, DeleteEventArgs a)
		{
			CloseApplication ();
		}

		#endregion


		#region IInternetConnectionOptions Fields

		public string ProxyUserLogin { get { return txtProxyUserLogin.Text; } }

		public string ProxyUserPassword { get { return txtProxyUserPassword.Text; } }

		public string ProxyAddress { set { txtProxyAddress.Text = value; } get { return txtProxyAddress.Text; } }

		public string ProxyPortNumber { set { txtProxyPortNumber.Text = value; } get { return txtProxyPortNumber.Text; } }

		#endregion
	}
}

